package com.atguigu.yygh;

import com.atguigu.yygh.hystrix.HystrixErro;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author xdr630
 * @version 1.0
 * @date 2023/7/21 18:08
 */
@Repository
@FeignClient(value = "service-cmn")
public interface DictFeignClient {


    @ApiOperation(value = "获取数据字典名称")
    @GetMapping(value = "/admin/cmn/dict/getName/{parentDictCode}/{value}")
    public String getNameByValueAndParentId(
            @ApiParam(name = "value", value = "值", required = true) @PathVariable Integer value,
            @ApiParam(name = "parentDictCode", value = "上级编码", required = true) @PathVariable Integer parentDictCode);

    @ApiOperation(value = "通过string获取数据字典名称")
    @GetMapping(value = "/admin/cmn/dict/getNameByString/{parentDictCode}/{value}")
    public String getNameByValueAndParentIdByString(
            @ApiParam(name = "value", value = "值", required = true) @PathVariable String value,
            @ApiParam(name = "parentDictCode", value = "上级编码", required = true) @PathVariable String parentDictCode);

    @ApiOperation(value = "获取数据字典名称")
    @GetMapping(value = "/admin/cmn/dict/getName/{value}")
    public String getNameByvalue(
            @ApiParam(name = "value", value = "值", required = true) @PathVariable Integer value);


    @ApiOperation(value = "获取详细地址名称")
    @GetMapping(value = "/admin/cmn/dict/getDetailAddress/{provinceCode}/{cityCode}/{districtCode}")
    public String getDetailAddress(
            @ApiParam(name = "provinceCode", value = "省", required = true) @PathVariable Integer provinceCode,
            @ApiParam(name = "cityCode", value = "市", required = true) @PathVariable Integer cityCode,
            @ApiParam(name = "districtCode", value = "区", required = true) @PathVariable Integer districtCode
    );

    //2023 8/23 18:08

    @ApiOperation(value = "通过value和DicCode查询name")
    @GetMapping(value = "/admin/cmn/dict/getNameByValueAndDicCode/{value}/{dictCode}")
    public String getNameByValueAndDicCode(@PathVariable String value, @PathVariable String dictCode);


    @ApiOperation(value = "获取数据字典名称 通过字符串")
    @GetMapping(value = "/admin/cmn/dict/getNameByString10/{value}")
    public String getNameByString10(
            @ApiParam(name = "value", value = "值", required = true)
            @PathVariable String value);



}